<?php
/**
 * 
 */

/**
 * Basic Functions to do things on the eclipse site that maybe needed anywhere
 *
 * @author anthony
 */
final class EclipseMDE {
    /**
     * Construct() not in use 
     */
    private function __construct() {}
    
    /**
     * Determine if the current page is being run through mod_rewrite or not
     * @global type $_SERVER
     * @return boolean 
     */
    public static function runningOnMod_Rewrite() {
	global $_SERVER;
	if(isset($_SERVER['REDIRECT_URL'])) {
	    return true;
	} else {
	    return false;
	}
    }
    
    /**
     * Convert a Tool alias to a tool link
     * @param string $alias
     * @return string 
     */
    public static function aliasLink($alias) {
	return '/tool/'.$alias;
    }
    
    /**
     * Convert a username alias to a user profile link
     * @param string $username
     * @return string 
     */
    public static function userLink($username) {
	return '/user/'.$username;
    }
    
    /**
     * Convert a RSS Feed alias to a rss link
     * @global type $_ECLIPSEMDE
     * @param string $alias
     * @return string 
     */
    public static function rssLink($alias) {
	global $_ECLIPSEMDE;
	return $_ECLIPSEMDE['BASE_URL'].'/rss/'.$alias;
    }
}

?>
